import { POP, NEW, SELL } from "./const";
import BackTop from "components/content/backtop/BackTop";
//////////////////////////////////////////////////////类可以用继承
// class Animal {
//     run() {
//     }
// }
// 继承类
// class Person extends Animal {
// }
// class Dog extends Animal {
// }

/////////////////////////////////////////////////////对象用混入mixin
//多处用到BackTop组件，可以把一些重复的代码用mixin封装，再分别调用
export const backTopMixin = {
    components: {
        BackTop
    },
    data: function() {
        return {
            isShowBackTop: false
        }
    },
    methods: {
        backTop: function() {
            this.$refs.scroll.scrollTo(0, 0, 300);
        }
    }
}

//点击tab颜色随之变化
export const tabControlMixin = {
    data: function() {
        return {
            currentType: POP
        }
    },
    methods: {
        tabClick(index) {
            switch (index) {
                case 0:
                    this.currentType = POP
                    break
                case 1:
                    this.currentType = NEW
                    break
                case 2:
                    this.currentType = SELL
                    break
            }
            console.log(this.currentType);
        }
    }
}